<?php 
	$_products = $this->getProductCollection();

	$_helper = $this->helper('catalog/output');
	$setting 	=	Mage::helper('multidealpro');

	$limitproduct = $this->getLimitCount();
	$size = $_products->count();
	if($limitproduct == "" || $limitproduct > $size){
		$limitproduct = $size;
	}

	$title = $this->getFrontendTitle();
	$desc  = $this->getFrontendDescription();
	$wrapclass = $this->getCustomClass();
	$w = $this->getThumbnailWidth();
	$h = $this->getThumbnailHeight();
	$_columnCount = $this->getColumnCount();
?>
<?php if ($limitproduct): ?>
    <?php $i=0; foreach ($_products->getItems() as $_product): ?>
    	<div class="<?php if($itemClass = $this->getData('item_class')) echo $itemClass.' '; ?>item<?php echo $_columnCount > 0 && $i%$_columnCount==0 || $_columnCount <= 0 && $i == 0 ?' first':''; ?><?php echo $_columnCount > 0 && ($i+1)%$_columnCount==0 || $i+1 == $limitproduct ?' last':''; ?>"
    		style="<?php echo $this->getItemWidth() ? 'width:'.$this->getItemWidth().'px;' : '' ?> <?php echo $this->getItemHeight() ? 'height:'.$this->getItemHeight().'px;' : '' ?> <?php echo $this->getItemSpacing() ? 'margin-right:'.$this->getItemSpacing().'px;margin-bottom:'.$this->getItemSpacing().'px;' : '' ?>">
            <div class="product-item">
    			<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>" class="product-image">
    				<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($w,$h) ?>" width="<?php echo $w; ?>" height="<?php echo $h ;?>" alt="<?php echo $this->stripTags($_product->getName(), null, true) ?>" />
    
    				<!-- Show Label -->
    				<?php if ($this->ShowLabel()): ?>
    					<?php echo $setting->getLabel($_product) ?>
    				<?php endif; ?>
    			</a>
    
    			<div class="product-shop">
    				<div class="f-fix">
    					<!--product name -->
    					<?php if ($this->ShowProductName() =='true'):?>
    						<h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></a></h3>
    					<?php endif;?>
    
    					<!-- Show Price -->
    					<?php if ($this->ShowPrice()): ?>
    						<?php echo $this->getPriceHtml($_product, true) ?>
    					<?php endif; ?>
                        
                        <!-- Show Reviews -->
						<?php if ($setting->getMainDeal_ShowReview()):?>
							<?php //if($_product->getRatingSummary()): ?>
								<?php echo $this->getReviewsSummaryHtml($_product,"short") ?>
							<?php //endif; ?>
						<?php endif ?>
                        
                        <!-- Show Description -->
						<div class="desc std">
							<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
							<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
						</div>
    
    					<?php $status = $_product->getDealStatus(); ?>
    					<!-- Show qty item left && Clock Countdown -->
    					<?php if ($status == 2): ?>
    						<div class="msg_soldout"><?php echo $this->__('Time Out') ?></div>
    					<?php else: ?>
    						<?php if($setting->getShowQty()):?>
    						   <?php echo $setting->getQtyleft($_product); ?>
                            <?php endif;?>
    
    						<div class="deal_info" style="display:none"><?php echo $setting->getInfo(1,$this->ShowLabel(),$this->ShowPrice(),$this->ShowAddtocart(),$this->ShowAddto()) ?></div>
    
    						<?php echo Mage::helper('multidealpro/clock')->getClock($_product); ?>
    					<?php endif ?>
    					<div class="em-btn-addto">
    						<!-- Show Button AddtoCart -->
    						<?php if ($status == 1 && $this->ShowAddtocart() == 'true'): ?>
    							<?php if($_product->isSaleable()): ?>
    								<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
    							<?php else: ?>
    								<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
    							<?php endif; ?>
    						<?php endif; ?>
    
    						<!-- Show Wishlist/Compare Link -->
    						<?php if ($this->ShowAddto()  == 'true'): ?>
    							<ul class="add-to-links">
    								<?php if ($this->helper('wishlist')->isAllow()) : ?>
    									<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist" title="<?php echo $this->__('Add to Wishlist') ?>"><?php echo $this->__('Add to Wishlist') ?></a></li>
    								<?php endif; ?>
    								<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
    									<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare" title="<?php echo $this->__('Add to Compare') ?>"><?php echo $this->__('Add to Compare') ?></a></li>
    								<?php endif; ?>
    							</ul>
    						<?php endif ?>
    					</div>
    				</div>
    			</div>
            </div>
    	</div>
    	<?php $i++;?>
    	<?php if ($i >= $limitproduct) break; ?>
    <?php endforeach; ?>
<?php else:?>
	<p class="note-msg"><?php echo Mage::helper('multidealpro')->getGeneral_NoDeal() ?></p>
<?php endif; ?>